<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>母婴信息系统</title>
	  <link rel="stylesheet" type="text/css" href="/layui/css/layui.css"  media="all">
  <link rel="stylesheet" type="text/css" href="/css/front/base.css">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
       

<div class="table" style="margin-top: 150px;">
	<form action="" method="post" class="layui-form">
		<div style="margin-top: 15px;">
			<img class="icon" src="/images/logo.png"/>
			<label class="title">母婴信息系统</label>
	    </div>

	    <div style="margin-top: 20px;">
	    	<label class="label">帐号：</label>
	    	<input class="input" type="text" name="account" lay-verify="title" autocomplete="off" placeholder="请输入登录账号" class="layui-input">
	    </div>

	    <div style="margin-top: 50px;">
	    	<label class="label">密码：</label>
	    	<input class="input" type="password" name="password" lay-verify="pass" placeholder="请输入密码" autocomplete="off" class="layui-input">
	    </div>

	    <div style="margin-left: 450px; margin-top: 15px; ">
	    	<a href="" style="color: blue">忘记密码？</a>
		</div>

	    <div style="margin-top: 20px;">
	    	<button class="login" lay-filter="login" lay-submit>登录</button>
	    	<button class="register" onclick="register();return false;">注册</button>
	    </div>

	</form>
</div>

</body>
<script type="text/javascript" src="/layui/layui.js"></script>

<script>
    layui.use(['form','layer','jquery'],function() {
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer
        $ = layui.jquery;

        //登录按钮
        form.on("submit(login)", function (data) {
            var x = $(this);
            $.ajax({
                type: "POST",
                url: "/console/login?flag=1",  //后台程序地址
                data:data.field,
                success: function(data){           //后台程序返回的标签，比如我喜欢使用1和0 表示成功或者失败
                    if (data.status==200){   //如果成功了
                        window.location.href =data.msg;
                    }else if(data.status==500){
                        layer.msg(data.msg);
                    }
                }
            })
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        })
    })
	function register() {
		window.location.href="/register.html";
    }
</script>
</html>